/*
 * util.hpp
 *
 *  Created on: Sep 7, 2013
 *      Author: jason
 */

#ifndef UTIL_HPP_
#define UTIL_HPP_

// The path node class to be used by A-Star path-finding algorithm
class PathNode {
public:
	// Grid coordinates
	int x, y;
	// Total node cost
	int f;
	// Cost from starting point
	int g;
	// heuristic cost estimate
	int h;
	// parent's grid coordinates
	int parent_x, parent_y;
	PathNode() : x(-1), y(-1), f(0), g(0), h(0), parent_x(0), parent_y(0)
	{}
	PathNode(int r, int c) : x(r), y(c), f(0), g(0), h(0), parent_x(0), parent_y(0)
	{}
	bool operator==(const PathNode& node) const {
		return ((this->x == node.x) && (this->y == node.y));
	}
	bool operator!=(const PathNode& node) const {
		return ((this->x != node.x) && (this->y != node.y));
	}
	bool operator<(const PathNode& node) const {
		return (this->f > node.f);
	}
};


#endif /* UTIL_HPP_ */
